<?php


namespace King\Service;



class PokerSortService
{

    /**
     * 冒泡排序
     * @param array $list
     * @return array
     */
    public function numberSort(array $list): array
    {
        $list = array_values($list);
        $len = count($list);
        for ($i = 0; $i < $len - 1; $i++) {
            for ($j = 0; $j < $len - 1 - $i; $j++) {
                if ($list[$j]['name'] > $list[$j + 1]['name']) {
                    $tmp = $list[$j];
                    $list[$j] = $list[$j + 1];
                    $list[$j + 1] = $tmp;
                }
            }
        }
        return $list;
    }

}